package proxy.jdk.service;

import proxy.jdk.service.impl.AccountServiceImpl;
import proxy.jdk.service.proxy.AccountAdvise;

import java.lang.reflect.Proxy;

public class ProxyMain {
  public static void main(String[] args) {
    AccountServiceImpl target = new AccountServiceImpl();


    AccountService proxy = (AccountService) Proxy.newProxyInstance(
            target.getClass().getClassLoader(),
            target.getClass().getInterfaces(),
            new AccountAdvise(target));

    proxy.sayYouWant();

    System.out.println(proxy);
  }
}
